<template>
<div>
  <div class="right_proaducts">我的位置&gt;&gt;科技项目申报&gt;管理项目分类列表</div>
  <div id="container">
    <div id="content2">
      <table width="100%" height="41" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="15" height="18" align="left" valign="top">
            <div align="left"></div>
          </td>
          <td width="385" align="left" valign="bottom" class="12">&nbsp;</td>
        </tr>
        <tr>
          <td height="4" colspan="2" align="left" valign="bottom"></td>
        </tr>
        <tr>
          <td height="15" align="left" valign="top">&nbsp;</td>
          <td height="15" align="left" valign="top" class="12">
            <table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td height="20">
                    <DIV class=padding>
                      <DIV id=middlebody>
                        <table width="100%" border="0" cellpadding="0" cellspacing="1" :data="categories">
                          <tbody>
                          <tr>
                            <td width="10%" align="center" valign="center" bgcolor="#fba661">
                              编号ID
                            </td>
                            <td width="40%" align="center" valign="center" bgcolor="#fba661">
                              分类名称
                            </td>
                            <td width="20%" align="center" valign="center" bgcolor="#fba661">
                              申报开始时间
                            </td>
                            <td width="20%" align="center" valign="center" bgcolor="#fba661">
                              申报结束时间
                            </td>
                            <td width="10%" align="center" valign="center" bgcolor="#fba661">
                              项目
                            </td>
                          </tr>
                          <tr v-for="(cate) in categories" :key="cate.categoryid">
                            <td align="center" valign="center" bgcolor="#f3f3f3">{{cate.categoryid}}</td>
                            <td align="center" valign="center" bgcolor="#f3f3f3">{{cate.categoryname}}</td>
                            <td align="center" valign="center" bgcolor="#f3f3f3">{{cate.expStartTime}}</td>
                            <td align="center" valign="center" bgcolor="#f3f3f3">{{cate.expStopTime}}</td>
                            <td align="center" valign="center" bgcolor="#f3f3f3">
                              <router-link :to="{path:'/declare/expert/showProjects',query:{cid:cate.categoryid}}">项目</router-link></td>
                          </tr>
                          </tbody>
                        </table>
                        </div>
                    </div>
                </td>
              </tr>
            </table>
            <br/>
            <div class="table_wz"></div>
          </td>
        </tr>
      </table>
    </div>
  </div>
  <div id="container">
    <div id="footer">
      <p><a href="http://www.ascenttech.com.cn/" target="_blank">版权所有：北京亚思晟商务科技有限公司 &copy;2004-2008|京ICP备05005681</a>
      </p>
    </div>

  </div>
</div>
</template>

<script>
export default {
  name: "showProjectCategories",
  data() {
    return {
      uid: JSON.parse(sessionStorage.getItem("userInfo")).uid || "",
      categories: {}
    }
  },
  mounted() {
    this.getCid();
    this.getCategoriesList();
  },
  methods: {
    //注销
    logout(){
      sessionStorage.clear();
    },
    //获取项目categoryId
    getCid() {
      var strings = window.location.href.split('?')[1];
      let getCid = new URLSearchParams('?' + strings)  //将参数放在URLSearchParams函数中
      let cid = getCid.get('cid');
      // console.log(cid);
      return cid;
    },
    getCategoriesList() {
      var _this = this;
      this.$axios({
        url: `http://localhost:8080/api/expert/select/categories/${_this.uid}`,
        method: 'get',
      }).then((res) => {
        // console.log(res);
        if(res.data.code == 200){
          _this.categories = res.data.data.categories;
        }
      })
    }
  }
}
</script>

<style scoped>

</style>
